<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Defines a list of up to 4 $_SERVER variables that should be modified for execution</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="phar.mount.html">« Phar::mount</a></li>
      <li style="float: right;"><a href="phar.offsetexists.html">Phar::offsetExists »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.phar.html">Phar</a></li>
    <li>Defines a list of up to 4 $_SERVER variables that should be modified for execution</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="phar.mungserver" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Phar::mungServer</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL phar &gt;= 2.0.0)</p><p class="refpurpose"><span class="refname">Phar::mungServer</span> &mdash; <span class="dc-title">Defines a list of up to 4 $_SERVER variables that should be modified for execution</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-phar.mungserver-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>Phar::mungServer</strong></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$variables</code></span>): <span class="type"><span class="type void">void</span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>Phar::mungServer()</strong></span> should only be called within the
   stub of a phar archive.
  </p>
  <p class="para">
   Defines a list of up to 4 <var class="varname"><a href="reserved.variables.server.html" class="classname">$_SERVER</a></var> variables that should be
   modified for execution.
   Variables that can be modified to remove traces of phar execution are
   <code class="literal">REQUEST_URI</code>, <code class="literal">PHP_SELF</code>,
   <code class="literal">SCRIPT_NAME</code> and <code class="literal">SCRIPT_FILENAME</code>.
  </p>
  <p class="para">
   On its own, this method does nothing.  Only when combined with
   <span class="function"><a href="phar.webphar.html" class="function">Phar::webPhar()</a></span> does it take effect, and only when the requested
   file is a PHP file to be parsed.  Note that the
   <code class="literal">PATH_INFO</code> and <code class="literal">PATH_TRANSLATED</code> variables
   are always modified.
  </p>
  <p class="para">
   The original values of variables that are modified are stored in the SERVER
   array with <code class="literal">PHAR_</code> prepended, so for instance
   <code class="literal">SCRIPT_NAME</code> would be saved as <code class="literal">PHAR_SCRIPT_NAME</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-phar.mungserver-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">variables</code></dt>

     <dd>

      <p class="para">
       an array containing as string indices any of
       <code class="literal">REQUEST_URI</code>, <code class="literal">PHP_SELF</code>,
       <code class="literal">SCRIPT_NAME</code> and <code class="literal">SCRIPT_FILENAME</code>.
       Other values trigger an exception, and <span class="function"><strong>Phar::mungServer()</strong></span>
       is case-sensitive.
      </p>
     </dd>

    
   </dl>

  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-phar.mungserver-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   No return.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-phar.mungserver-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   Throws <span class="classname"><a href="class.unexpectedvalueexception.html" class="classname">UnexpectedValueException</a></span> if any problems are
   found with the passed in data.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-phar.mungserver-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-746">
    <p><strong>示例 #1 A <span class="function"><strong>Phar::mungServer()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;example&nbsp;stub<br /></span><span style="color: #0000BB">Phar</span><span style="color: #007700">::</span><span style="color: #0000BB">mungServer</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'REQUEST_URI'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">Phar</span><span style="color: #007700">::</span><span style="color: #0000BB">webPhar</span><span style="color: #007700">();<br />__HALT_COMPILER();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-phar.mungserver-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="phar.webphar.html" class="function" rel="rdfs-seeAlso">Phar::webPhar()</a> - Routes a request from a web browser to an internal file within the phar archive</span></li>
    <li class="member"><span class="function"><a href="phar.setstub.html" class="function" rel="rdfs-seeAlso">Phar::setStub()</a> - Used to set the PHP loader or bootstrap stub of a Phar archive</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>